const express = require('express');
const path = require('path');
const app = express();
const expressWS = require('express-ws');
const websocket = require('./websocket')
expressWS(app);

// 中间件
app.use('/zhangsan', express.static(path.join(__dirname, './public/zhangsan.html')));
app.use('/lisi', express.static(path.join(__dirname, './public/lisi.html')));



// ws://localhost:8080/ws
app.use('/ws', websocket)

app.use(express.static(path.join(__dirname, './public')));


let port = 8080;
app.listen(port, () => {
    console.log(`server running at http://localhost:${port}`);
})